package org.wh1tew0lf.vframe.framework;

import java.util.HashMap;
import java.util.Map;

import org.wh1tew0lf.vframe.framework.vframeexception.VFrameException;

public class FrameTest {

	/**
	 * @param args
	 * @throws VFrameException
	 */
	public static void main(String[] args) throws VFrameException {
		/*VDatabaseRestriction target = VDatabaseRestriction.greaterThan("field1", 12);
		target = target.andLessThan("field1", 89);
		target = target.orLessThan("field1", 987);
		target = target.and(VDatabaseRestriction.newWithFieldAndValue("field1", VDatabaseRestrictionOperator.GREATER_THAN_OR_EQUAL_TO, VDatabaseValue.min("field1")));
		target = target.andOracleTextContains("field1", VDatabaseValue.oracleTextWithIn("test", "head"), 1);
		Map<String, String> fieldNameMap = new HashMap<String, String>();
		fieldNameMap.put("field1", "COL_1");
		System.out.println(target.toString(false, fieldNameMap));
		target = null;*/
		Map<String, String> fieldNameMap = new HashMap<String, String>();
		fieldNameMap.put("field1", "COL_1");
		fieldNameMap.put("field2", "COL_2");
		fieldNameMap.put("field3", "COL_3");
		VDatabaseRestriction targetPart1 = VDatabaseRestriction.greaterThan("field1", 35);
		VDatabaseRestriction targetPart2 = VDatabaseRestriction.lessThan("field2", 55);
		VDatabaseRestriction target1 = VDatabaseRestriction.beginWithIgnoreCases("field3", "s&ev'&'en").and(targetPart1).and(targetPart2);
		VDatabaseRestriction target2 = VDatabaseRestriction.beginWith("field3", "seven").and(targetPart1).and(targetPart2);
		System.out.println(target1.isEqualTo(target2, true));
		System.out.println(target1.isEqualTo(targetPart2, true));
		System.out.println(target1.toString(false, fieldNameMap));
		VDatabaseOrdership ordership = VDatabaseOrdership.newOrder("field1", VDatabaseOrdership.ASC_ORDER, "field2", VDatabaseOrdership.DESC_ORDER, "field3", "known");
		VDatabaseOrdership ordership2 = VDatabaseOrdership.newOrder("field1", VDatabaseOrdership.ASC_ORDER, "field2", VDatabaseOrdership.DESC_ORDER, "field3", "known");
		System.out.println(ordership.toString(false, fieldNameMap));
		System.out.println(ordership.isEqualTo(ordership2));
		VDatabaseQueryStructure qs = new VDatabaseQueryStructure(-1, target1, ordership);
		System.out.println(qs.toString(fieldNameMap));
	}

}
